
/*
 * @author Adley, Butcher, and Sanders
 * CSC 285 Final Project
 */

package tetris;

import java.awt.Color;
import java.awt.Graphics;
import javax.swing.BorderFactory;
import javax.swing.JPanel;


public class ShapePanel extends JPanel{
    
    private boolean show = false;
    private Color color;
    private int x_coordinate;
    private int y_coordinate;
    private Color baseColor;
    
    public ShapePanel(){
         setBorder(BorderFactory.createEtchedBorder());
       }
    
    @Override
    public void paintComponent(Graphics g){
        if(show){            
            g.setColor(color);
            g.fillRect(0, 0, getWidth(), getHeight());
            revalidate();
        }else{
            g.setColor(baseColor);
            g.fillRect(0, 0, getWidth(), getHeight());
            revalidate();
        }
        
    }
    
    public void changefill(){
        show = !show;
        repaint();
        revalidate();
    }
    
    public boolean isfilled(){
        return show;
        
    }
    
    public void turnshowoff(){
        show = false;
    }
    
    public void setFill(boolean fill){
        show = fill;
        repaint();
        revalidate();
    }
    
    public void setColor(Color color){
        this.color = color;
    }
    
    public void setBaseColor(Color baseColor){
        this.baseColor = baseColor;
    }
        
    public void setCoordinate(int x_coordinate, int y_coordinate){
        this.x_coordinate = x_coordinate;
        this.y_coordinate = y_coordinate;
    }
    
    public int getXcoordinate(){
        return x_coordinate;
    }
    public int getYcoordinate(){
        return y_coordinate;
    }
}
